e
#Title[uPv]
#Text[Ex in dream
uPv]
#BackGround[User]
#BGM[.\..\bgm\bgm.wav]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
	
	////////////////////////////////////////////////////////////////////////
	//                                                          //
	//   CtȂ̗͂_炩                               //
	//   ʂ̓WJʂ𑽂߂                                             //
	//   ʂ̔ˊpx@ق̏đ_悤ɂ         //
	////////////////////////////////////////////////////////////////////////
	
	@Initialize{
		InitializeData();
		
		LoadUserShotData(shot_ryoyan);
		
		SetLife(1000);
		SetMovePosition03(GetCenterX(),100,10,8);
		SetDamageRate(22,16);
		SetInvincibility(240 + 60);
		SetCollisionEx(32,16);
		SetEnemyMarker(true);
		
		TMain();
	}
	
	@MainLoop{
		yield;
	}
	
	@DrawLoop{
		DrawBoss(imgBoss);
	}
	
	@Finalize{
		FinalizeData();
	}
	
	task TMain(){
		wait(60);
		
		DeclareSpell();
		
		Atack();
		Move();
	}
	
	function DeclareSpell(){
		SetTimer(90);
		CutIn(YOUMU,"uPv",NULL,0,0,0,0);
		SetScore(1000000);
		wait(180);
	}
	
	task Atack(){
		onPose = true;
		Concentration01(60);
		PlaySE(se_charge);
		wait(60);
		onPose = false;
		
		AtackA();
		AtackB();
	}
	
	task AtackA(){
		let tm = 1;
		let frame = 0;
		
		loop{
			ascent(cnt in 0..15 - tm * 2){
				CreateShot02(GetX(),GetY(),1,GetAngleToPlayer() + frame * 2 - cnt * 3,(3 + cnt) / 100,99,_RED21(),0);
				CreateShot02(GetX(),GetY(),1,GetAngleToPlayer() - frame * 2 + cnt * 3,(3 + cnt) / 100,99,_RED21(),0);
			}
			
			frame += 3;
			
			wait(3);
		}
	}
	
	task AtackB(){
		let tm = 1;
		
		loop{
			CreateShot01(GetX(),GetY(),1.4,GetAngleToPlayer() + rand(1.5,90) * (rand_int(0,1) * 2 - 1),_RED03(),0);
			
			wait(6);
		}
	}
	
	task Move(){
		let tm=0;
		
		wait(90);
		
		loop{
			if( GetPlayerX() > GetX() ){
				tm = GetX() + 15;
			}else{
				tm = GetX() - 15;
			}
			
			SetMovePosition03(tm,rand(50,70),3,1);
			
			wait(100);
		}
	}
	
	#include_function ".\..\functions\initialize.txt"
	#include_function ".\..\functions\color_set.txt"
	#include_function ".\..\functions\function.txt"
}
